<!--
 @description PoSsku列表
 @fileName index.vue
 @author zengqiongying
 @created 2022/08/05 09:19:38
-->
<template>
  <Popup
    v-model="popShow"
    position="bottom"
    title="商品列表"
    :show-cancel-button="false"
    :show-confirm-button="false"
  >
    <div class="sku-box">
      <Scroll vertical height="100%">
        <div v-for="(item,i) in list" :key="i" class="sku-list">
          <div class="sku-image">
            <ImageVideo :src="item.mainPicUrl" fit="fill" />
          </div>
          <div class="sku-content">
            <div class="cell-con">
              <div class="name">{{ item.skuName }}</div>
              <div class="tags">
                <template v-if="item.productFlag==='05'">
                  <span class="tag">样</span>
                  <span class="tag">赠</span>
                </template>
                <span v-if="item.productFlag==='02'" class="tag">样</span>
                <span v-if="item.productFlag==='03'" class="tag">赠</span>
              </div>
            </div>
            <div class="cell-foot">
              <span v-if="item.isActivity===1" class="icon-special-price" />
              <span v-if="item.productFlag && ['03','05'].includes(item.productFlag)" class="sale-price">0</span>
              <span v-else class="sale-price">
                {{ item.salePrice || 0 }}
              </span>
              <span class="org-price">¥{{ item.orangePrice || 0 }}</span>
              <span class="quantity">x{{ item.quantity }}</span>
            </div>
          </div>
        </div>
      </Scroll>
    </div>
  </Popup>
</template>

<script>
import Popup from '@/components/Popup'
import Scroll from '@/components/Scroll'
import ImageVideo from '@/components/ImageVideo'
export default {
  name: 'PopSkuList',
  components: { Popup, Scroll, ImageVideo },
  props: {
    show: {
      type: Boolean,
      default: false
    },
    list: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {

    }
  },

  computed: {
    popShow: {
      set(val) {
        this.$emit('update:show', val)
      },
      get(val) {
        return this.show
      }
    }
  },
  methods: {

  }
}

</script>
<style lang='less' scoped>
.sku-box{
  position: relative;
  padding-top: 20px;
  height: 70vh;
}
.sku-list{
  display: flex;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #EFF2F7;
  &:last-child{
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
  }
  .sku-image{
    width: 110px;
    height: 110px;
    overflow: hidden;
    border-radius: 6px;
    margin-right: 10px;
  }
  .sku-content{
    flex: 1;
    min-height: 110px;
    display: flex;
    justify-content: space-between;
    flex-direction:column;
    color: #333333;
    font-size: 14px;
    .name{
      margin-bottom: 6px;
      max-height: 40px;
      line-height: 20px;
      font-size: 14px;
      font-weight: bold;
      color: #333333;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      overflow: hidden;
      -webkit-line-clamp:2;
    }

    .tags{
      height: 20px;
      margin-top: 8px;
      .tag{
        display: inline-block;
        padding: 4px;
        line-height: 1;
        background: rgba(234, 91, 49, .1);
        border-radius: 6px;
        margin-right: 8px;
        color: #FF6345;
        font-size: 10px;
        text-align: center;
      }
    }
    .cell-foot{
      display: flex;
      align-items: baseline;
    }
    .icon-special-price{
      margin-right: 4px;
      width: 41px;
      height:16px;
      background: url(~@/assets/my/icon-special-price.png) no-repeat;
      background-size: 41px 16px;
    }
    .sale-price{
      margin-right:10px;
      font-size: 18px;
      color: #FD5001;
      font-weight: bold;
      &::before{
        content: '¥';
        font-size: 12px;
        font-weight: normal;
        margin-right: 3px;
      }
    }
    .org-price{
      flex: 1;
      font-size: 12px;
      color: #A8B0C5;
      text-decoration:line-through;
    }

  }
}
</style>
